//
//  DMSUCacheItem.m
//  DualMediationSDK
//
//  Created by YeJary on 2025/8/5.
//

#import "DMSUCacheItem.h"

#define SUCACHEITEM_TOKEN_KEY @"token"
#define SUCACHEITEM_PROFILE_KEY @"profile"

@interface DMSUCacheItem()


@end

@implementation DMSUCacheItem

+ (BOOL)supportsSecureCoding
{
    return YES;
}

- (id)initWithCoder:(NSCoder *)aDecoder
{
    DMSUCacheItem *item = [[DMSUCacheItem alloc] init];
    item.profile = [aDecoder decodeObjectOfClass:[FBSDKProfile class] forKey:SUCACHEITEM_PROFILE_KEY];
    item.token = [aDecoder decodeObjectOfClass:[FBSDKAccessToken class] forKey:SUCACHEITEM_TOKEN_KEY];
    return item;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:self.profile forKey:SUCACHEITEM_PROFILE_KEY];
    [aCoder encodeObject:self.token forKey:SUCACHEITEM_TOKEN_KEY];
}

@end
